#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Date : 2024/10/25
# @Author : shiyou pan

"""
NOTE:
"""

from math import log, exp


def logit(x: float) -> float:
    if x <= 0 or x >= 1:
        raise ValueError("x must be between 0 and 1")
    return log(x / (1 - x))


def logit_inverse(x: float) -> float:
    return exp(x) / (1 + exp(x))


if __name__ == '__main__':
    print(logit(0.1))
    print(logit_inverse(0.1))
